import { HttpStatus } from "@nestjs/common";
import { IHttpError, IHttpErrorResponse } from "./http-error-response";

export class HttpRequestException {
  constructor (
    private errors: IHttpError[],
    private httpStatus: HttpStatus
  ) {}

  public getErrors (): IHttpError[] {
    return this.errors;
  }

  public getStatusCode (): HttpStatus {
    return this.httpStatus;
  }

  public getHttpResponse (): IHttpErrorResponse {
    return {
      statusCode: this.httpStatus,
      message: 'bad request',
      errors: this.errors,
    };
  }
}